********************************************************************************
******************************** Descriptives **********************************
******************************************************************************** 

		use "ZA6804_v6-0-0_processed.dta", clear	
	
	*** FIGURE 1b: Party positions (from Chapel Hill Expert Survey)
		preserve

			* open CHES 2017
			use "combined_means_2017", clear
		
			egen cult_dim=rowmean(galtan galtan_new immigrate_policy multiculturalism) if galtan!=. & immigrate_policy!=. & multiculturalism!=.
				label variable cult_dim "cultural dimension (GALTAN, migration and multiculturalism)"
				label variable lrecon "Position on economic dimension"
				label variable immigrate_policy "Position on immigration policy"
		
				replace party="Greens" if party=="Grunen"
				replace party="The Left" if party=="Linke"

			twoway (scatter cult_dim lrecon if party_id==301 , mlabel(party) mlabangle(45) msymbol(D) mcolor(black) mlabcolor(black)) ///
				(scatter cult_dim lrecon if party_id==308, mlabel(party) mlabangle(45) msymbol(D) mcolor(black) mlabcolor(black)) ///
				(scatter cult_dim lrecon if party_id==302, mlabel(party) mlabangle(45) msymbol(D) mcolor(red) mlabcolor(red))	/// 
				(scatter cult_dim lrecon if party_id==303, mlabel(party) mlabangle(45) msymbol(D) mcolor(sand) mlabcolor(sand)) ///	
				(scatter cult_dim lrecon if party_id==304, mlabel(party) mlabangle(45) msymbol(D) mcolor(green) mlabcolor(green)) ///
				(scatter cult_dim lrecon if party_id==306, mlabel(party) mlabangle(45) msymbol(D) mcolor(purple) mlabcolor(purple)) ///
				(scatter cult_dim lrecon if party_id==310, mlabel(party) mlabangle(45) msymbol(D) mcolor(blue) mlabcolor(blue)), ///
				ylabel(0 "libertarian" 1 2 3 4 5 6 7 8 9 10 "authoritarian", angle(forty_five)) xlabel(0 "left" 1 2 3 4 5 6 7 8 9  10 "right", angle(forty_five)) ///
					xline(5) yline(5) legend(off) xsize(5) name(GER2017_CHES_cult_dim, replace) nodraw
				
			twoway (scatter immigrate_policy lrecon if party_id==301 , mlabel(party) mlabangle(45) msymbol(D) mcolor(black) mlabcolor(black)) ///
				(scatter immigrate_policy lrecon if party_id==308, mlabel(party) mlabangle(45) msymbol(D) mcolor(black) mlabcolor(black)) ///
				(scatter immigrate_policy lrecon if party_id==302, mlabel(party) mlabangle(45) msymbol(D) mcolor(red) mlabcolor(red))	/// 
				(scatter immigrate_policy lrecon if party_id==303, mlabel(party) mlabangle(45) msymbol(D) mcolor(sand) mlabcolor(sand)) ///	
				(scatter immigrate_policy lrecon if party_id==304, mlabel(party) mlabangle(45) msymbol(D) mcolor(green) mlabcolor(green)) ///
				(scatter immigrate_policy lrecon if party_id==306, mlabel(party) mlabangle(45) msymbol(D) mcolor(purple) mlabcolor(purple)) ///
				(scatter immigrate_policy lrecon if party_id==310, mlabel(party) mlabangle(45) msymbol(D) mcolor(blue) mlabcolor(blue)), ///
				ylabel(0 "open" 1 2 3 4 5 6 7 8 9 10 "restrictive", angle(forty_five)) xlabel(0 "left" 1 2 3 4 5 6 7 8 9  10 "right", angle(forty_five) ) /// 
					xline(5) yline(5) legend(off) xsize(5) name(GER2017_CHES_immigrate_policy, replace) nodraw
		
		restore

	
	*** FIGURE 1a: Voter positions in two-dimensional policy space
			graph twoway ///
			(scatter w7_migrrestr_ego w7_highertaxes_ego if w7_leftright_cat==3, jitter(11) msize(vsmall) msymbol(dh) mcolor(blue)) ///
			(scatter w7_migrrestr_ego w7_highertaxes_ego if w7_leftright_cat==2, jitter(11) msize(vsmall) msymbol(oh) mcolor(black)) ///
			(scatter w7_migrrestr_ego w7_highertaxes_ego if w7_leftright_cat==1, jitter(11) msize(vsmall) msymbol(+) mcolor(red) legend(off) ///
				xlabel(1 "lower" 2 3 4 5 6 7 "higher", angle(forty_five)) xscale(range(0.25 7.75)) ///
				ylabel(1 "facilitate" 2 3 4 5 6  7 "restrict", angle(forty_five)) yscale(range(0.25 7.75)) ysize(5) ///
				xsc(reverse) xtitle(Position on economic dimension: taxes & welfare benefits) ytitle(Position on cultural dimension: immigration) name(voter_positions_GLES, replace))

	* Combine to FIGURE 1
	graph combine voter_positions_GLES GER2017_CHES_immigrate_policy, xsize(8) iscale(1.1) imargin(vsmall) name(Figure1, replace)
					
		
		
	*** FIGURE A4: leftright position by quadrant
			clonevar quadrant2=quadrant
			label variable quadrant2 "policy quadrant"
			label define quadrant2 0 "residual" 4 "left-authoritarian" 2 "left-libertarian" 3 "right-authoritarian" 1 "right-libertarian"
			label values quadrant2 quadrant2
			
			tab w7_leftright quadrant2, row 
			spineplot w7_leftright quadrant2, percent xlabel(, angle(90) axis(2)) xsize(9) ///
					bar1(color(blue*2)) bar2(color(blue*1.75)) bar3(color(blue*1.5)) bar4(color(blue*1.25)) bar5(color(blue*1)) ///
					bar6(color(black)) ///
					bar11(color(red*2)) bar10(color(red*1.75)) bar9(color(red*1.5)) bar8(color(red*1.25)) bar7(color(red*1)) ///
					ysize(5) name(LR_byquadrant, replace)
			
			
	*** FIGURE 2: vote choices by left-authoritarian dummy and by quadrant
			* by left-authoritarian dummy
			tab w7_leftauth w8_vote, row 
			tab w7_leftauth w8_vote, row 
			bysort w8_vote w7_leftauth: gen freq1 = _N
			gen freq=(freq1/1551)*100 if w7_leftauth==1
			replace freq=(freq1/5910)*100 if w7_leftauth==0
			replace freq=round(freq, .1)

			spineplot w8_vote w7_leftauth, percent text(freq, mlabsize(*0.9) mlabcolor(white)) ///
					scheme(plottig) bar1(color(blue)) bar2(color(purple)) bar3(color(dkgreen)) bar4(color(sand)) bar5(color(red)) bar6(color(black)) xsize(7) name(mosaic1, replace) nodraw

			* by quadrant
			tab quadrant w8_vote, row nol
			bysort w8_vote quadrant: gen frequ1 = _N
			gen frequ=(frequ1/3313)*100 if quadrant==0
			replace frequ=(frequ1/1551)*100 if quadrant==4
			replace frequ=(frequ1/921)*100 if quadrant==2
			replace frequ=(frequ1/1450)*100 if quadrant==3
			replace frequ=(frequ1/242)*100 if quadrant==1

			replace frequ=round(frequ, .1)
			spineplot w8_vote quadrant, percent text(frequ, mlabsize(*0.9) mlabcolor(white)) ///
					scheme(plottig) bar1(color(blue)) bar2(color(purple)) bar3(color(dkgreen)) bar4(color(sand)) bar5(color(red)) bar6(color(black)) xsize(8) name(mosaic2, replace) nodraw

			graph combine mosaic1 mosaic2, rows(2) imargin(medsmall) iscale(*.8) name(LAvotechoices, replace)
	
	
	*** FIGURE 3: party placement of left-authoritarians
	*** where do left-authoritarians located the party they voted for in the policy space?
		global jittersize=2.5 
		graph twoway ///			
				(scatter w7_migrrestr_cdu w7_highertaxes_cdu if w7_leftauth==1 & w8_vote==1 & kp1_2601!=9, jitter($jittersize ) msize(vsmall) msymbol(+) mcolor(black) legend(off) ///
					xlabel(1 "lower" 2 3 4 5 6 7 "higher", angle(020)) xscale(range(0.25 7.75)) ///
					ylabel(1 "facilitate" 2 3 4 5 6  7 "restrict", angle(020)) yscale(range(0.25 7.75)) ysize(5) ///
					xtitle(" ") ytitle(" ") title(CDU/CSU)) ///
				(scatter w7_migrrestr_csu w7_highertaxes_csu if w7_leftauth==1 & w8_vote==1 & kp1_2601==9, jitter($jittersize ) msize(vsmall) msymbol(+) mcolor(black) legend(off) ///
					xlabel(1 "lower" 2 3 4 5 6 7 "higher", angle(forty_five)) xscale(range(0.25 7.75)) ///
					ylabel(1 "facilitate" 2 3 4 5 6  7 "restrict", angle(forty_five)) yscale(range(0.25 7.75)) ///		
					xsc(reverse)), name(union, replace) xline(4) yline(4) nodraw

		twoway scatter w7_migrrestr_spd w7_highertaxes_spd if w7_leftauth==1 & w8_vote==4, jitter($jittersize ) msize(vsmall) msymbol(+) mcolor(black) legend(off) ///
				xlabel(1 "lower" 2 3 4 5 6 7 "higher", angle(forty_five)) xscale(range(0.25 7.75)) ///
				ylabel(1 "facilitate" 2 3 4 5 6  7 "restrict", angle(forty_five)) yscale(range(0.25 7.75)) ///
				xtitle("taxes & spending") ytitle(" ") title(SPD) ///
				xsc(reverse) name(spd, replace) xline(4) yline(4) nodraw
				
		twoway scatter w7_migrrestr_fdp w7_highertaxes_fdp if w7_leftauth==1 & w8_vote==5, jitter($jittersize ) msize(vsmall) msymbol(+) mcolor(black) legend(off) ///
				xlabel(1 "lower" 2 3 4 5 6 7 "higher", angle(forty_five)) xscale(range(0.25 7.75)) ///
				ylabel(1 "facilitate" 2 3 4 5 6  7 "restrict", angle(forty_five)) yscale(range(0.25 7.75)) ///			
				xtitle(" ") ytitle(" ") title(FDP) ///
				xsc(reverse) name(fdp, replace) xline(4) yline(4) nodraw
		
		twoway scatter w7_migrrestr_gruene w7_highertaxes_gruene if w7_leftauth==1 & w8_vote==6, jitter($jittersize ) msize(vsmall) msymbol(+) mcolor(black) legend(off) ///
				xlabel(1 "lower" 2 3 4 5 6 7 "higher", angle(forty_five)) xscale(range(0.25 7.75)) ///
				ylabel(1 "facilitate" 2 3 4 5 6  7 "restrict", angle(forty_five)) yscale(range(0.25 7.75)) ///		
				xtitle("taxes & spending") ytitle(" ") title(Greens) ///
				xsc(reverse) name(greens, replace) xline(4) yline(4) nodraw
				
		twoway scatter w7_migrrestr_linke w7_highertaxes_linke if w7_leftauth==1 & w8_vote==7, jitter($jittersize ) msize(vsmall) msymbol(+) mcolor(black) legend(off) ///
				xlabel(1 "lower" 2 3 4 5 6 7 "higher", angle(forty_five)) xscale(range(0.25 7.75)) ///
				ylabel(1 "facilitate" 2 3 4 5 6  7 "restrict", angle(forty_five)) yscale(range(0.25 7.75)) ///		
				xtitle("taxes & spending") ytitle("immigration") title(The Left) ///
				xsc(reverse) name(left, replace) xline(4) yline(4) nodraw

		twoway scatter w7_migrrestr_afd w7_highertaxes_afd if w7_leftauth==1 & w8_vote==322, jitter($jittersize ) msize(vsmall) msymbol(+) mcolor(black) legend(off) ///
				xlabel(1 "lower" 2 3 4 5 6 7 "higher", angle(forty_five)) xscale(range(0.25 7.75)) ///
				ylabel(1 "facilitate" 2 3 4 5 6  7 "restrict", angle(forty_five)) yscale(range(0.25 7.75)) ///
				xtitle(" ") ytitle("immigration") title(AfD) ///
				xsc(reverse) name(afd, replace) xline(4) yline(4) nodraw

		graph combine afd union fdp left spd greens, rows(2) imargin(tiny) iscale(*1.1) name(LApartylocations, replace) xcommon ycommon
			
							
	*** FIGURE A5: vote choices of left-authoritarians by most important problem
			tab w7_mip_cat w8_vote if w7_leftauth==1, row 
			drop freq*
			bysort w7_leftauth w8_vote w7_mip_cat: gen freq1 = _N if w7_leftauth==1
			gen freq=(freq1/330)*100 if w7_mip_cat==0 & w7_leftauth==1
			replace freq=(freq1/503)*100 if w7_mip_cat==1 & w7_leftauth==1
			replace freq=(freq1/668)*100 if w7_mip_cat==2 & w7_leftauth==1
			replace freq=round(freq, .1)

			spineplot w8_vote w7_mip_cat if w7_leftauth==1, percent text(freq, mlabsize(*0.9) mlabcolor(white)) ///
					scheme(plottig) bar1(color(blue)) bar2(color(purple)) bar3(color(dkgreen)) bar4(color(sand)) bar5(color(red)) bar6(color(black)) ///
					xsize(7) name(votechoicesbyMIP, replace)
	
	
	*** TABLE A3: Factor analysis demonstrating two-dimensionality 
			* Rename variables for factor analysis
			clonevar refugeecap=kp7_2880x
			clonevar assimilation=kp7_1210
			clonevar EUintegration=kp7_1250
			clonevar crime=kp3_2880h
			clonevar samesex=kp4_2880a

			clonevar econintervention=kp5_2880g
			clonevar redistribution=kp7_2880d
			clonevar taxrich=kp7_2880j

			* Run factor analysis
			factor w7_migrrestr_ego refugeecap assimilation EUintegration crime samesex ///
					w7_highertaxes_ego econintervention redistribution taxrich, pcf
			rotate, promax
			
			predict f1 f2
			pwcorr f1 f2

			
	*** Figure A6: Most competent party on most important problem named by respondents
			recode kp7_850a (1=1 "CDU/CSU") (4=2 "SPD") (5=3 "FDP") (6=4 "Greens") (7=5 "The Left") (322=6 "AfD") (801=7 "other party") (808=8 "no party") (809=9 "all parties similar"), gen(MIP_partycompetent)
			label variable MIP_partycompetent "Most competent party regarding most important issue"

			recode kp7_850a (1=1 "CDU/CSU") (4=2 "SPD") (5=3 "FDP") (6=4 "Greens") (7=5 "The Left") (322=6 "AfD") (801 808 809=. ), gen(MIP_partycompetent2)

			recode w8_vote (1=1 "CDU/CSU") (4=2 "SPD") (5=3 "FDP") (6=4 "Greens") (7=5 "The Left") (322=6 "AfD"), gen(w8_vote_recode)

			hist MIP_partycompetent if w7_leftauth==1, by(w7_mip_cat, rows(3) note(" ") title("Party most competent at handling MIP")  legend(off)) xla( 1 (1) 9, valuelabel angle(045)) ///
				discrete percent xtitle(" ") addlabel addlabopts(yvarformat(%4.1f) mlabsize(small)) name(hist_MIP_partycompetent, replace)

			hist MIP_partycompetent2 if w7_leftauth==1, by(w7_mip_cat, rows(3) note(" ") title("Party most competent at handling MIP")  legend(off)) xla( 1 (1) 9, valuelabel angle(045)) ///
				discrete percent xtitle(" ") addlabel addlabopts(yvarformat(%4.1f)) name(hist_MIP_partycompetent2, replace)

			hist w8_vote_recode if w7_leftauth==1, by(w7_mip_cat, rows(3) note(" ") title("Vote choice")) xla( 1 (1) 6, valuelabel angle(045)) ylabel(0 (10) 40) discrete percent ///
				xtitle(" ") name(hist_w8vote, replace)